###############################################################################
 # Copyright (C) 2010 Chris Wroe
 #
 # Modifications to the initial code base are copyright of their respective
 # authors, or their employers as appropriate.
 #
 # This program is free software; you can redistribute it and/or modify it under
 # the terms of the GNU Lesser General Public License as published by the Free
 # Software Foundation; either version 2.1 of the License, or (at your option)
 # any later version.
 #
 # This program is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 # details.
 #
 # You should have received a copy of the GNU Lesser General Public License
 # along with this program; if not, write to the Free Software Foundation, Inc.,
 # 59 Temple Place, Suite 330, Boston, MA 02111-1307
 ##############################################################################

$LOAD_PATH << File.expand_path("/Users/chriswroe/Documents/snomed")

require "rubygems"
require "neo4j"
require 'fileutils'
require 'lucene'
include Lucene

#require "spec_helper"

#stop

Neo4j::Config[:storage_path] = '/Users/chriswroe/NetBeansProjects/Confusion/etc/db/neo'

Lucene::Config[:storage_path] = '/Users/chriswroe/NetBeansProjects/Confusion/etc/db/lucene'

Lucene::Config[:store_on_file] = true

FileUtils.rm_rf Neo4j::Config[:storage_path]
FileUtils.rm_rf Lucene::Config[:storage_path] unless Lucene::Config[:storage_path].nil?

require "model"

puts Lucene::Config[:storage_path]
puts Lucene::Config[:store_on_file]

Neo4j::BatchInserter.new do
  Neo4j::Transaction.new
  a = Concept.new
  a.name = 'test1'
  a.snomed_code = '1234'

  Neo4j::Transaction.finish
end

Neo4j::Transaction.new
Neo4j.all_nodes { |e| puts e }
puts "---"
Concept.all.nodes.each { |e| puts e}
puts "---"
Neo4j::Transaction.finish


puts Neo4j::Transaction.running?
Neo4j.stop


Neo4j::Transaction.new
c_search = Concept.find(:snomed_code=>'1234')
c = c_search[0]
d = Description.new
d.term = 'test term'
d.description_id = '7890'
d.concept = c
#b.concept.new(a1)
Neo4j::Transaction.finish




Neo4j::Transaction.new
res= Description.find(:description_id=>'7890')
res.each {|r| puts r}
des=res[0]

des.print 1
puts '---'
des.rels.each {|r| puts r._java_node.getType()}

puts '---'

des._java_node.getPropertyKeys().each {|p| puts p}
puts des._java_node.getProperty('_classname')

#  d1 = Description.new :term => "test1"
#
#  d1.concept.new(a1)
Neo4j::Transaction.finish



#stop# To change this template, choose Tools | Templates
# and open the template in the editor.

puts "Hello World"
